package zy.blue7.gui.netty.custom.qq.service.impl;

import io.netty.channel.Channel;
import zy.blue7.gui.netty.custom.qq.Server;
import zy.blue7.gui.netty.custom.qq.message.Message;
import zy.blue7.gui.netty.custom.qq.message.SingleMessage;
import zy.blue7.gui.netty.custom.qq.service.MessageHandler;

import java.io.IOException;

/**
 * @author blue7
 * @version 1.0
 * @date 2022/2/28 9:19
 */
public class SingleMessageHandlerImpl implements MessageHandler {
    @Override
    public void handle(Message message, Channel channel) throws IOException {
        System.out.println(message);
        System.out.println(message.getClass());
        System.out.println("SingleMessage....");

        SingleMessage singleMessage = (SingleMessage) message;

        Channel fromChannel = Server.map.get(singleMessage.getFrom());
        Channel toChannel = Server.map.get(singleMessage.getTo());

        sendMessage(singleMessage, channel);

    }
}
